#include "Col.ph"
#ifdef __GNUG__
#pragma implementation
#endif

#include "ObjInt.h"

#include "Class.h"
#include "String.h"

NewMetaImpl(ObjInt,Object, (T(val)));

//---- an integer object -------------------------------------------------------

u_long ObjInt::Hash()
{
	return (u_long) val;
}

bool ObjInt::IsEqual(Object* op)
{
	return op->IsKindOf(ObjInt) && val == ((ObjInt*)op)->val;
}

int ObjInt::Compare(Object* op)
{
	return val - Guard(op, ObjInt)->val;
}

const char *ObjInt::AsString()
{
	return form("%d", val);
}

OStream& ObjInt::PrintOn(OStream &s)
{
	Object::PrintOn(s);
	return s << val SP;
}

IStream& ObjInt::ReadFrom(IStream &s)
{
	Object::ReadFrom(s);
	return s >> val;
}
